home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / os2 / pvm34b3.zip / pvm34b3 / pvmtest / pvm_test.h < prev    next >
C/C++ Source or Header  |  1995-05-22  |  9KB  |  217 lines

  1. /****************************************/
  2. /*          Includes                */
  3. /****************************************/
  4.  
  5. #include <stdlib.h>
  6. #include <stdio.h>
  7. #include <string.h>
  8. #include <pvm3.h>
  9. #include <ctype.h>
  10. #include <signal.h>
  11. #include <time.h>
  12. #include <sys/time.h>
  13. #include <sys/types.h>
  14. #include <sys/param.h>
  15. #include <limits.h>
  16. #include <netdb.h>
  17. #include <assert.h>
  18.  
  19. /****************************************/
  20. /*    Tests Modules            */
  21. /****************************************/
  22.  
  23. #define NUMBER_OF_TESTS     107    /* number of test modules             */
  24. #define NUMBER_TEST_DIGITS    3     /* maximum number of digits of NUMBER_OF_TESTS    */
  25.  
  26. #define    NOT_YET_PROCESSED    0    /*                        */
  27. #define    NOT_POSSIBLE        -3    /*                        */
  28. #define    NOT_COMPLETED        -2    /*        Test Status            */
  29. #define PASSED            1    /*                        */
  30. #define FAILED            -1    /*                        */
  31.  
  32. /* flag structure */
  33. typedef struct {
  34.     int    perform;                /* Do we perform the test or not    */
  35.     int     after_hosts;                /* Number of Hosts after completion     */
  36.         }test_flag;
  37.  
  38. #define ALL_HOSTS        999            /* I want all hosts for that test    */
  39. #define    ALL_ARCHS        666            /* I want one host of each architecture */
  40.  
  41. /* Test_module */
  42. typedef struct{
  43.     
  44.     char            description[60];                /* Description of the test module    */
  45.  
  46.     test_flag    flag;                /* Flags                */
  47.     int        num_req_hosts;            /* Number of hosts required        */
  48.     short        status;                /* Status of the test module        */
  49.     short        (*proc_master)();        /* Pointer to the master function    */
  50.     void         (*proc_slave)();        /* Pointer to the slave function    */
  51.         }test_module;
  52.  
  53. typedef test_module module_array[NUMBER_OF_TESTS];     /* Array of modules             */
  54. module_array *masters;                    /* Pointer to an array of modules    */
  55.  
  56. /****************************************/
  57. /*    Host Pool and descriptor    */
  58. /****************************************/
  59.  
  60. #define MAX_HOST        20            /* Max number of hosts in the config.    */
  61. #define MAX_HOST_NAME_LENGTH    20            /* Max length of a host name        */
  62. #define VERSION_SLAVE        "version_slave"        /* Name of the version slave        */
  63.  
  64. #define    TIMEOUT_MESSAGE        60            /* number of 1 sec. retries         */
  65. #define    TIMEOUT_ADD_DELETE    30            /* number of 1 sec. retries        */
  66. #define TIMEOUT_KILL        30            /* number of 1 sec. retries             */
  67. #define BUSY_LOOP_PERF        50000            /* number of iterations od the busy loop*/
  68.                             /* ( busy loop for timing tests )    */
  69.  
  70. char    *hostpool[MAX_HOST];                /* array of non-master hosts        */
  71. char    *hostarch[MAX_HOST];                /* array of architectures        */
  72. char    *diff_arch[MAX_HOST];                /* array of distinct architectures    */
  73.  
  74. /****************************************/
  75. /*          INPUT / OUTPUT        */ 
  76. /****************************************/
  77.  
  78. #define MAX_LINE_LENGTH         80            /* Max length of a line in input file    */
  79.  
  80. #define COMBOS_PREFIX           "all_combinations :"    /*                    */
  81. #define HOST_PREFIX             "config :"        /*     General options prefix        */
  82. #define OUTFILE_PREFIX          "outfile :"        /*                    */
  83. #define    OUTFILE_MAX_LENGTH    40            /*                    */
  84.  
  85. #define MAX_LENGTH_PREFIX       "max_length :"        /*                    */
  86. #define START_LENGTH_PREFIX     "start_length :"    /*    tests 45 & 46 prefix        */
  87. #define INCR_PREFIX             "incr :"        /*                    */
  88.  
  89.  
  90. #define LENGTH_PREFIX        "messages_length :"    /*                    */
  91. #define    NUM_PREFIX        "num_messages :"    /*        tests 48 -> 107        */
  92. #define    FUNNELING_PREFIX    "funneling_proc :"    /*        prefix            */    
  93. #define TIMING_TOTAL_PREFIX    "total_timing :"    /*                    */
  94. #define TIMING_AVERAGE_PREFIX    "average_timing :"    /*                    */
  95.  
  96. #define ALL_TESTS_PREFIX        "all_tests :"        /*                    */
  97. #define    ALL_MESSAGING_PREFIX        "all_messaging :"    /*    Subsets of tests        */
  98. #define ALL_ROUTINE_PREFIX        "all_routine :"        /*        prefixes        */
  99. #define ALL_FUNNEL_NODATA_PREFIX    "all_funnel_nodata :"    /*                    */
  100. #define ALL_FUNNEL_DATA_PREFIX        "all_funnel_data :"    /*                    */
  101. #define ALL_HEAD_NODATA_PREFIX        "all_head_nodata :"    /*                    */
  102. #define ALL_HEAD_DATA_PREFIX        "all_head_data :"    /*                    */
  103. #define ALL_TRIANGLE_NODATA_PREFIX    "all_triangle_nodata :"    /*                    */
  104. #define ALL_TRIANGLE_DATA_PREFIX    "all_triangle_data :"    /*                    */
  105. #define ALL_PERF_PREFIX            "all_perf :"        /*                    */
  106.  
  107. #define    OUT45            "/tmp/output_45.dat"    /*    Output file for test #45    */
  108. #define OUT46            "/tmp/output_46.dat"    /*    Output file for test #46    */
  109.  
  110. FILE    *outfile;
  111. FILE    *out45;
  112. FILE    *out46;
  113.  
  114. /****************************************/
  115. /*          MESSAGES TAGS        */
  116. /****************************************/
  117.  
  118. #define ACKNOLEDGE        9            /* tag for acknoledging slave start        */
  119. #define VERSION_TAG        10            /* tag of message returning version number    */
  120. #define JOINED            11            /* tag acknoledging a group joining        */
  121. #define SIGNAL            12            /* tag acknowledging of a interrupt signal    */ 
  122. #define    BYE            13            /* tag telling to the slave to exit        */
  123. #define    TEST_VALUE        14            /* tag for value coherency            */
  124. #define    TEST_CAST        15            /* tag for broadcast test            */
  125. #define    TEST_BARRIER        16            /* tag for barrier test                */
  126. #define    TEST_REDUCE        17            /* tag for reduce test                */
  127. #define    TEST_GATHER        18            /* tag for gather test                */
  128. #define    TEST_SCATTER        19            /* tag for scatter test                */
  129. #define TEST_MCAST        20            /* tag for mcast test                */
  130. #define    LATENCY            21            /* tag for latency measurement messages        */
  131. #define BANDWIDTH        22            /* tag for bandwidth measurements messages    */
  132. #define HEAD_HEAD        23            /* tag for head-head test            */
  133. #define    TRIANGLE        24            /* tag for triangle test            */
  134. #define    FUNNELING        25            /* tag for funneling                */
  135. #define    NOTIFY            26            /* tag for notify test                */
  136. #define    ENDLESS            99            /* to let the slaves do non-busy waiting    */
  137.  
  138. /****************************************/
  139. /*          MISCELLENAOUS        */
  140. /****************************************/
  141.  
  142. #define GROUP_NAME        "Testgrp"        /* group name                    */
  143. #define SNOOZ                   1               /* maximum delay accepted for pvm_config races  */
  144. #define TEST_SLAVE        "pvm_test_slave"    /* Generic slave name                */
  145. #define    HIGH_LEVEL        1            /* Exit code for term()                */
  146. #define    OK_LEVEL        2            /* End code for term()                */
  147. #define SEC_TRECV        10            /* Number of seconds timeout for the trecv test */
  148. #define    SEC_NRECV        10            /* Number of seconds timeout for the nrecv test */
  149.  
  150. /*********************************************/
  151. /* PARAMETERS FOR THE LATENCY-BANDWIDTH TEST */
  152. /*********************************************/
  153.  
  154. #define    TRIALS            10            /* Trials fo average latency/bandwidth comput.    */
  155. #define    TIME_ELAPSED        (t2.tv_sec-t1.tv_sec+(t2.tv_usec-t1.tv_usec)*1.E-6)
  156.  
  157. int    max_size        ;            /*                        */
  158. int    start_size        ;            /*  parameters for tests #45 and #46           */
  159. int    incr            ;            /*                        */
  160.  
  161. #define MAX_SIZE_DEFAULT    1000            /*                        */
  162. #define START_SIZE_DEFAULT    100            /*   Default parameters for tests #45 amd #46    */
  163. #define INCR_DEFAULT        100            /*                         */
  164.  
  165. #define MAX_MESSAGE_LENGTH    100000            /* Maximum allowable message length        */
  166.  
  167. int    all_combos        ;            /* Do we try all the architectures combinations */
  168.  
  169. #define    ALL_COMBOS_DEFAULT    0            /*    default parameter for all_combos    */
  170.  
  171. /****************************************************/
  172. /* PARAMETERS FOR THE GENERAL MESSAGE-PASSING TESTS */
  173. /****************************************************/
  174.  
  175. #define EMPTY            0            /* Empty Messages                */
  176. #define NOT_EMPTY        1            /* Not empty messages                */
  177. #define MCAST            0            /* Use of pvm_mcast()                */
  178. #define SEND            1            /* Use of pvm_send()-pvm_recv()         */
  179. #define PSEND            2            /* Use of pvm_psend()-pvm_precv() if possible    */
  180.  
  181. int     num_messages            ;                       /*   Number of messages for tests mes_pass      */
  182. int     messages_length         ;                       /*   Length of these messages                   */
  183. int    timing_average        ;            /*   Do we time the average communication time    */    
  184. int    timing_total        ;            /*   Do we time the total communication time    */
  185.  
  186. #define    NUM_MESSAGES_DEFAULT    10            /*                        */
  187. #define MESSAGES_LENGTH_DEFAULT    100            /*                        */
  188. #define FUNNELING_DEFAULT    4            /*    Default parameters            */
  189. #define    TIMING_AVERAGE_DEFAULT  0            /*                        */
  190. #define    TIMING_TOTAL_DEFAULT    0            /*                        */
  191.  
  192. /****************************************************/
  193. /* PARAMETERS FOR THE SUBSETS OF TESTS            */
  194. /****************************************************/
  195.  
  196. int    all_tests        ;
  197. int    all_messaging        ;
  198. int    all_routine        ;
  199. int    all_funnel_nodata    ;
  200. int    all_funnel_data        ;
  201. int    all_head_nodata        ;
  202. int    all_head_data        ;
  203. int    all_triangle_nodata    ;
  204. int    all_triangle_data    ;
  205. int    all_perf        ;
  206.  
  207. #define    ALL_TESTS_DEFAULT        0
  208. #define    ALL_MESSAGING_DEFAULT        0
  209. #define    ALL_ROUTINE_DEFAULT        0
  210. #define    ALL_FUNNEL_NODATA_DEFAULT    0
  211. #define ALL_FUNNEL_DATA_DEFAULT        0
  212. #define ALL_HEAD_NODATA_DEFAULT        0
  213. #define ALL_HEAD_DATA_DEFAULT        0
  214. #define ALL_TRIANGLE_NODATA_DEFAULT    0
  215. #define    ALL_TRIANGLE_DATA_DEFAULT    0
  216. #define    ALL_PERF_DEFAULT        0
  217.